package org.example.test.mapper;

import org.apache.ibatis.annotations.*;
import org.example.test.entity.Dept;

import java.util.List;

@Mapper
public interface DeptMapper {
    @Select("SELECT * FROM test.dept where dname like '%${dname}%'")
    List<Dept> findAll(String dname);

    @Delete("delete  from test.dept where deptno = #{deptno}")
    int delete(Integer deptno);

    @Update("update dept set deptno = #{deptno},dname = #{dname},loc = #{loc} where deptno=#{deptno}")
    int editDept(Dept dept);

    @Insert("INSERT into dept(deptno,dname,loc)values " +
            "(#{deptno},#{dname},#{loc})")
    int addDept(Dept dept);
}
